<?php

namespace App\Models;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;

class RecordStaffPractice extends Model
{
    protected $fillable = [
    	'store_id',
	    'staff_practice_time',
	    'price',
	    'picture',
	    'remark'
    ];
    
    public function setPictureAttribute($pictures)
	{
	    if (is_array($pictures)) {
	        $this->attributes['picture'] = json_encode($pictures);
	    }
	}
    
    public function getPictureAttribute($value)
    {
    	$value = json_decode($value);
    	return $value;
    }
    
    public function setPriceAttribute($value)
    {
        $this->attributes['price'] = $value * 100;
    }
    
    public function getPriceAttribute($value)
    {
        return $value / 100;
    }
}
